#include <STC89C5xRC.H>

void Delay(unsigned int xms)    //@12.000MHz
{
    unsigned char data i, j;

    while(xms--){
        i = 2;
        j = 239;
        do
        {
            while (--j);
        } while (--i);
    }
}
	

unsigned char showNumber[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6f};
	
void MyLed(unsigned char location,number){
	switch(location){
		case 1: P24 = 1;P23 = 1;P22 = 1;break;
		case 2: P24 = 1;P23 = 1;P22 = 0;break;
		case 3: P24 = 1;P23 = 0;P22 = 1;break;
		case 4: P24 = 1;P23 = 0;P22 = 0;break;
		case 5: P24 = 0;P23 = 1;P22 = 1;break;
		case 6: P24 = 0;P23 = 1;P22 = 0;break;
		case 7: P24 = 0;P23 = 0;P22 = 1;break;
		case 8: P24 = 0;P23 = 0;P22 = 0;break;
	};
	P0 = showNumber[number];
	Delay(1);
	P00 = 0x00;
}

 

void main(){

	while(1){
		MyLed(1,1);
//		Delay(20);
		MyLed(2,2);
//		Delay(20);
		MyLed(3,3);
//		Delay(20);
		MyLed(4,6);
//		Delay(20);
	}
}
